from selenium import  webdriver
import time
from selenium.webdriver.common.by import By

d = webdriver.Chrome()
d.maximize_window()  #最大化窗口
d.get("https://www.qq.com")
time.sleep(1)
# 定位搜索图标
search_button = d.find_element(By.CSS_SELECTOR, '[id="searchSmart"]')
res = search_button.is_displayed()  # is_displayed()方法，显示返回True，不显示返回False
print(res)

# 隐藏元素：只能定位、不可以操作 click() send_keys() clear()...
# style="display:none;"    type="hidden"

# 如何执行js 语句 JavaScript
# window.scrollTo(0,与顶部的距离)；  拉动窗口的滚动条
js = "window.scrollTo(0,500);"
d.execute_script(js)
time.sleep(3)